require 'pipe'
class Main297
  include Filters
  
  attr_reader :history, :filters, :combinations, :all_result
  
  def initialize
    @history = [
    [01, 12, 17, 19, 20, 22, 26],
    [01, 04, 06, 12, 13, 24, 27],
    [07, 13, 19, 21, 22, 25, 28],
    [01, 8, 9, 11, 20, 24, 26],
    [03, 05, 07, 14, 20, 25, 26],
    [8, 13, 20, 22, 24, 25, 28],
    [01, 8, 9, 14, 15, 22, 23],
    [8, 15, 17, 20, 27, 28, 29],
    [04, 13, 16, 21, 23, 25, 27],
    [03, 8, 11, 16, 19, 22, 24],
    ]
    
    @filters = [
    not_(all_even()), 
    not_(all_odd()), 
    SumRange.new((60..140)), 
    ContinuousLimit.new(4), 
    RangeLimit.new((1..10), (11..20), (21..29)),
    PreviousLimit.new(self.history, 3),
    LastLimit.new(self.history, 3),
    ]
    
    @combinations = (1..29).to_a.combination(7)
    
    @all_result = Main3.new(*self.filters).process(self.combinations)
    
  end
  
  def run
    10.times { print self.all_result.choice, "\n" }    
  end  
end

Main_297 = Main297.new

require "test/unit"

class PipeTest < Test::Unit::TestCase
  def test_should_call_all_filters
    Main_297.run
  end
  
#  def test_enum
#    for bingo in Main_297.history
#      assert Main_297.all_result.include?(bingo)
#    end
#  end
end
